import { defineStore } from 'pinia'

// 导入所有图片
import drone1 from '@/assets/images/drone1.jpg'
import drone2 from '@/assets/images/drone2.jpg'
import drone3 from '@/assets/images/drone3.jpg'
import drone4 from '@/assets/images/drone4.jpg'
import drone5 from '@/assets/images/drone5.jpg'
import drone6 from '@/assets/images/drone6.jpg'
import drone7 from '@/assets/images/drone7.jpg'
import drone8 from '@/assets/images/drone8.jpg'
import toy1 from '@/assets/images/toy1.jpg'
import toy2 from '@/assets/images/toy2.jpg'
import toy3 from '@/assets/images/toy3.jpg'
import toy4 from '@/assets/images/toy4.jpg'
import car1 from '@/assets/images/car1.jpg'
import car2 from '@/assets/images/car2.jpg'
import car3 from '@/assets/images/car3.jpg'

interface Product {
  id: number
  title: string
  price: number
  description: string
  image: string
  details: string
  category: string
}

export const useProductStore = defineStore('products', {
  state: () => ({
    products: [
      {
        id: 1,
        title: "Professional Camera Drone X500",
        price: 599.99,
        description: "High-performance camera drone with 4K video capability and 30-minute flight time",
        image: drone1,
        details: "Features include GPS positioning, return-to-home function, and obstacle avoidance",
        category: "drone"
      },
      {
        id: 2,
        title: "Mini Racing Drone Pro",
        price: 299.99,
        description: "Compact racing drone perfect for beginners and intermediate pilots",
        image: drone2,
        details: "High-speed motors, durable frame, and FPV camera system included",
        category: "drone"
      },
      {
        id: 3,
        title: "STEM Robot Building Kit",
        price: 79.99,
        description: "Educational robot kit for children to learn programming and robotics",
        image: toy1,
        details: "Includes 300+ pieces, programmable controller, and detailed instructions",
        category: "toy"
      },
      {
        id: 4,
        title: "Remote Control Monster Truck",
        price: 129.99,
        description: "All-terrain RC monster truck with shock absorption system",
        image: toy2,
        details: "4WD system, rechargeable battery, and durable construction",
        category: "toy"
      },
      {
        id: 5,
        title: "Agricultural Mapping Drone",
        price: 899.99,
        description: "Professional drone for agricultural surveying and crop monitoring",
        image: drone3,
        details: "Multispectral imaging, automated flight planning, and crop health analysis",
        category: "drone"
      },
      {
        id: 6,
        title: "Interactive Learning Robot",
        price: 149.99,
        description: "AI-powered educational robot for children aged 5-12",
        image: toy3,
        details: "Voice recognition, educational games, and parental controls",
        category: "toy"
      },
      {
        id: 7,
        title: "Beginner Training Drone",
        price: 149.99,
        description: "Perfect first drone with easy controls and safety features",
        image: drone4,
        details: "Altitude hold, headless mode, and protective propeller guards",
        category: "drone"
      },
      {
        id: 8,
        title: "Construction Vehicle Set",
        price: 89.99,
        description: "Set of 5 die-cast construction vehicles with moving parts",
        image: toy4,
        details: "Includes excavator, dump truck, crane, bulldozer, and cement mixer",
        category: "toy"
      },
      {
        id: 9,
        title: "FPV Racing Drone Kit",
        price: 449.99,
        description: "Complete FPV racing drone kit with goggles and controller",
        image: drone5,
        details: "Carbon fiber frame, high-performance motors, and digital FPV system",
        category: "drone"
      },
      {
        id: 10,
        title: "Science Experiment Kit",
        price: 59.99,
        description: "Educational science kit with 50+ experiments",
        image: toy4,
        details: "Safe materials, detailed manual, and storage case included",
        category: "toy"
      },
      {
        id: 11,
        title: "Underwater ROV Drone",
        price: 799.99,
        description: "Professional underwater drone for exploration and photography",
        image: drone6,
        details: "4K camera, 100m depth rating, and LED lighting system",
        category: "drone"
      },
      {
        id: 12,
        title: "Magnetic Building Blocks",
        price: 49.99,
        description: "Creative magnetic construction set with 100 pieces",
        image: toy1,
        details: "Compatible with all major magnetic building sets",
        category: "toy"
      },
      {
        id: 13,
        title: "Foldable Selfie Drone",
        price: 199.99,
        description: "Portable drone with gesture control and auto-follow modes",
        image: drone7,
        details: "1080p camera, facial recognition, and compact folding design",
        category: "drone"
      },
      {
        id: 14,
        title: "Remote Control Robot Dog",
        price: 169.99,
        description: "Interactive robotic pet with realistic movements",
        image: toy2,
        details: "Voice commands, programmable actions, and emotional responses",
        category: "toy"
      },
      {
        id: 15,
        title: "Professional Inspection Drone",
        price: 1299.99,
        description: "Industrial drone for building and infrastructure inspection",
        image: drone8,
        details: "Thermal camera, zoom lens, and weatherproof design",
        category: "drone"
      },
      {
        id: 16,
        title: "Electronic Science Lab Kit",
        price: 89.99,
        description: "Complete electronics learning kit with 100+ projects",
        image: car3,
        details: "Safe components, comprehensive manual, and storage case",
        category: "toy"
      },
      {
        id: 17,
        title: "4WD RC Drift Car Pro",
        price: 329.00,
        description: "1:16 Scale RC Drift Car with 360° Rotating and Gesture Control",
        image: car1,
        details: "2.4Ghz control system, rechargeable batteries, LED lights, and professional drift tires",
        category: "car"
      },
      {
        id: 18,
        title: "Monster Truck RC Car",
        price: 369.00,
        description: "Off-road RC Monster Truck with Double Sided 360° Flip",
        image: car2,
        details: "4WD system, shock absorbers, high-speed motor, and durable chassis",
        category: "car"
      },
      {
        id: 19,
        title: "Stunt RC Car Pro",
        price: 399.00,
        description: "Professional Stunt Car with All-Terrain Capabilities",
        image: car3,
        details: "Transform mode, LED lights, 2.4Ghz control, and long battery life",
        category: "car"
      },
      {
        id: 20,
        title: "Racing RC Car Elite",
        price: 418.00,
        description: "High-Speed Racing Car with Advanced Control System",
        image: drone1,
        details: "Precision steering, aerodynamic design, racing tires, and competition-grade components",
        category: "car"
      }
    ] as Product[]
  }),
  getters: {
    getAllProducts: (state) => state.products,
    getFeaturedProducts: (state) => state.products.slice(0, 4),
    getProductById: (state) => (id: number) => state.products.find(p => p.id === id),
    getProductsByCategory: (state) => (category: string) => state.products.filter(p => p.category === category)
  }
}) 